package dj.common.constants;


import lombok.Getter;

/**
 * 测试标识枚举(1:测试;0:非测试)
 * @author ZJG
 */
@Getter
public enum TestFlagEnum {

    TEST(Boolean.TRUE, "测试",1),
    NOT_TEST(Boolean.FALSE, "非测试",0),
    ;
    private Boolean flag;

    private Integer code;

    private String msg;

    TestFlagEnum(Boolean flag, String msg, Integer code) {
        this.flag = flag;
        this.msg = msg;
        this.code = code;
    }

    public static TestFlagEnum getTestFlagByCode(int code) {
        if (TestFlagEnum.TEST.getCode().intValue() == code) {
            return TestFlagEnum.TEST;
        }
        return TestFlagEnum.NOT_TEST;
    }

    public static TestFlagEnum getTestFlagByFlag(boolean flag) {
        if (flag) {
            return TestFlagEnum.TEST;
        } else {
            return TestFlagEnum.NOT_TEST;
        }
    }
}
